package com.xz.simplerpc.rpc.invokers;

import com.xz.simplerpc.extension.URL;
import com.xz.simplerpc.rpc.api.*;
import org.apache.commons.lang3.ArrayUtils;

/**
 * Created by fingal on 2018/1/7.
 */
public class RestInvoker<T> implements Invoker<T> {

    private final Class<T> type;

    private final URL url;

    public RestInvoker(Class<T> type, URL url) {
        this.type = type;
        this.url = url;
    }

    @Override
    public Class getInterface() {
        return type;
    }

    @Override
    public Result invoke(Invocation invocation) throws RpcException {
        System.out.println("method:" + invocation.getMethodName());
        System.out.println("args: " + ArrayUtils.toString(invocation.getArguments()));
        return new RpcResult("ok");
    }
}
